package org.opencv.samples.tutorial4;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.Window;

public class Sample4Mixed extends Activity 
{
    private static final String TAG = "Sample::Activity";

    private MenuItem mItemRestart;
    private MenuItem mItemDeleteAll;

    public static int restart   = 1;
    public static int deleteAll = 0;
    
    public Sample4Mixed() 
    {
        Log.i(TAG, "Instantiated new " + this.getClass());
    }

    
    
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        Log.i(TAG, "onCreate");
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(new Sample4View(this));
    }

    
    
    public boolean onCreateOptionsMenu(Menu menu) 
    {
        Log.i(TAG, "onCreateOptionsMenu");
        mItemRestart   = menu.add("Auto-Initialize tracking");
        mItemDeleteAll = menu.add("Delete all points");
        return true;
    }

    
    
    public boolean onOptionsItemSelected(MenuItem item) 
    {
        Log.i(TAG, "Menu Item selected " + item);
        if (item == mItemRestart)
        	restart = 1;
        else if (item == mItemDeleteAll)
        	deleteAll = 1;
        return true;
    }
}
